package com.changfen.domain;

import com.changfen.util.DateUtils;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;

/**
 * @author 86180
 * @Classname Kline
 * @Description TODO
 * @Date 2022/8/28 10:38
 */
@Data
@Document(indexName = "index-day-kline", shards = 3, replicas = 5)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class Kline implements Serializable {

    @Id
    @Field(type = FieldType.Keyword)
    private String id;

    /**
     * 时间
     */
    @Field(type = FieldType.Date, format = DateFormat.date, pattern = DateUtils.DATE_PATTERN)
    private Date date;
    /**
     * 时间戳
     */
    @Field(type = FieldType.Long)
    private Long timestamp;

    /**
     * 成交量
     */
    @Field(type = FieldType.Long)
    private Long volume;

    /**
     * 开盘价
     */
    @Field(type = FieldType.Float)
    private Float open;

    /**
     * 最高价
     */
    @Field(type = FieldType.Float)
    private Float high;

    /**
     * 最低价
     */
    @Field(type = FieldType.Float)
    private Float low;

    /**
     * 收盘价
     */
    @Field(type = FieldType.Float)
    private Float close;

    /**
     * 涨跌
     */
    @Field(type = FieldType.Float)
    private Float chg;

    /**
     * 涨跌幅
     */
    @Field(type = FieldType.Float)
    private Float percent;

    /**
     * 成交量
     */
    @Field(type = FieldType.Keyword)
    private String amount;

    @Field(type = FieldType.Text, fielddata = true)
    private String symbol;

}
